const options = [{
    value: 'zhinan',
    label: '指南',
    children: [{
        value: 'shejiyuanze',
        label: '设计原则',
        children: [{
            value: 'yizhi',
            label: '一致'
                    }, {
                value: 'fankui',
                label: '反馈'
                    }, {
                value: 'xiaolv',
                label: '效率'
                    }, {
                value: 'kekong',
                label: '可控'
                    }]
    }, {
        value: 'daohang',
        label: '导航',
        children: [{
            value: 'cexiangdaohang',
            label: '侧向导航'
                    }, {
                value: 'dingbudaohang',
                label: '顶部导航'
                    }]
    }]
}, {
    value: 'zujian',
    label: '组件',
    children: [{
        value: 'basic',
        label: 'Basic',
        children: [{
            value: 'layout',
            label: 'Layout 布局'
                    }, {
                value: 'color',
                label: 'Color 色彩'
                    }, {
                value: 'typography',
                label: 'Typography 字体'
                    }, {
                value: 'icon',
                label: 'Icon 图标'
                    }, {
                value: 'button',
                label: 'Button 按钮'
                    }]
    }, {
        value: 'form',
        label: 'Form',
        children: [{
            value: 'radio',
            label: 'Radio 单选框'
                    }, {
                value: 'checkbox',
                label: 'Checkbox 多选框'
                    }, {
                value: 'input',
                label: 'Input 输入框'
                    }, {
                value: 'input-number',
                label: 'InputNumber 计数器'
                    }, {
                value: 'select',
                label: 'Select 选择器'
                    }, {
                value: 'cascader',
                label: 'Cascader 级联选择器'
                    }, {
                value: 'switch',
                label: 'Switch 开关'
                    }, {
                value: 'slider',
                label: 'Slider 滑块'
                    }, {
                value: 'time-picker',
                label: 'TimePicker 时间选择器'
                    }, {
                value: 'date-picker',
                label: 'DatePicker 日期选择器'
                    }, {
                value: 'datetime-picker',
                label: 'DateTimePicker 日期时间选择器'
                    }, {
                value: 'upload',
                label: 'Upload 上传'
                    }, {
                value: 'rate',
                label: 'Rate 评分'
                    }, {
                value: 'form',
                label: 'Form 表单'
                    }]
    }, {
        value: 'data',
        label: 'Data',
        children: [{
            value: 'table',
            label: 'Table 表格'
                    }, {
                value: 'tag',
                label: 'Tag 标签'
                    }, {
                value: 'progress',
                label: 'Progress 进度条'
                    }, {
                value: 'tree',
                label: 'Tree 树形控件'
                    }, {
                value: 'pagination',
                label: 'Pagination 分页'
                    }, {
                value: 'badge',
                label: 'Badge 标记'
                    }]
    }, {
        value: 'notice',
        label: 'Notice',
        children: [{
            value: 'alert',
            label: 'Alert 警告'
                    }, {
                value: 'loading',
                label: 'Loading 加载'
                    }, {
                value: 'message',
                label: 'Message 消息提示'
                    }, {
                value: 'message-box',
                label: 'MessageBox 弹框'
                    }, {
                value: 'notification',
                label: 'Notification 通知'
                    }]
    }, {
        value: 'navigation',
        label: 'Navigation',
        children: [{
            value: 'menu',
            label: 'NavMenu 导航菜单'
                    }, {
                value: 'tabs',
                label: 'Tabs 标签页'
                    }, {
                value: 'breadcrumb',
                label: 'Breadcrumb 面包屑'
                    }, {
                value: 'dropdown',
                label: 'Dropdown 下拉菜单'
                    }, {
                value: 'steps',
                label: 'Steps 步骤条'
                    }]
    }, {
        value: 'others',
        label: 'Others',
        children: [{
            value: 'dialog',
            label: 'Dialog 对话框'
                    }, {
                value: 'tooltip',
                label: 'Tooltip 文字提示'
                    }, {
                value: 'popover',
                label: 'Popover 弹出框'
                    }, {
                value: 'card',
                label: 'Card 卡片'
                    }, {
                value: 'carousel',
                label: 'Carousel 走马灯'
                    }, {
                value: 'collapse',
                label: 'Collapse 折叠面板'
                    }]
    }]
}, {
    value: 'ziyuan',
    label: '资源',
    children: [{
        value: 'axure',
        label: 'Axure Components'
                }, {
            value: 'sketch',
            label: 'Sketch Templates'
                }, {
            value: 'jiaohu',
            label: '组件交互文档'
                }]
}]

/* 
    {
    "name": "qq",
    "code": "ww",
    "type": "1",
    "chargeNum": "33",
    "status": "1",
    "lat": "12121",
    "lng": "232323",
    "address": "yizhi",
    "addressInfo": "111",
    "com": "333",
    "pay": [
        1,
        2
    ],
    "park": "www",
    "free": [
        1
    ],
    "startTime": "2024-03-25",
    "endTime": "2024-03-15"
}
*/
function fetchDataList(data) {
    console.log("表格数据参数:", data);
    const nano = () => Math.ceil(Math.random() * 100 * Date.now()).toString(32)
    const mockData = {
        data: new Array(data?.pageSize).fill(1).map(() => {
            const id = nano()
            return {
                name: `充电站名称${id}`,
                status: Math.ceil(Math.random() * 3),
                "code": "ww",
                "type": Math.ceil(Math.random() * 3),
                "chargeNum": "33",
                "lat": "12121",
                "lng": "232323",
                "address": "yizhi",
                "addressInfo": "111",
                "com": "333",
                "pay": [1,2],
                "park": "www",
                "free": [1],
                "startTime": "2024-03-25",
                "endTime": "2024-03-15",
                id: id
            }
        }),
        totalCount: 18
    }
    return Promise.resolve(mockData)
}

export function buildChongDian(){
    return {
        searchForm:{
            inlineLabelWidth:"90px",
            setterFormValue:[
                {
                    component: "Input",
                    label: "充电站名称",
                    display: "inline",
                    name: "name",
                    placeholder: "请选择",
                },
                {
                    label: "充电站类型",
                    name: "type",
                    component: "Select",
                    display: "inline",
                    placeholder: "请选择报警名称",
                    dataSource: [
                        { "label": "类型1", "value": 1 },
                        { "label": "类型2", "value": 2 },
                        { "label": "类型3", "value": 3 },
                    ]
                },
                {
                    label: "充电站状态",
                    name: "status",
                    component: "Select",
                    display: "inline",
                    placeholder: "请选择报警名称",
                    dataSource: [
                        { "label": "状态1", "value": 1 },
                        { "label": "状态2", "value": 2 },
                        { "label": "状态3", "value": 3 },
                    ]
                },
                
            ],
            exportBtnProps:{
                onClick:()=>{
                    return Promise.resolve({ fileData: null, fileName:"ceshi.xlsx"})
                }
            }
        },
        tableActionBtns:{
            addBtnProps: {
                onClick: () => {
                    console.log('点击新增按钮')
                }
            },
        },
        table:{
            columns:[
                {
                    type:"index",
                },
                {
                    label:"充电站名称",
                    name:"name",
                    minWidth:"110"
                },
                {
                    label:"充电站ID",
                    name:"id"
                },
                {
                    label: "充电站类型",
                    name: "type",
                    minWidth: "110"
                },
                {
                    label: "充电站状态",
                    name: "status",
                    minWidth: "110"
                },
                {
                    label: "详细地址（省市区地址）",
                    name: "address",
                    minWidth:"200"
                },
                {
                    label: "充电桩数",
                    name: "chargeNum"
                },
                {
                    label: "所属单位",
                    name: "com"
                },
            ],
            fetchDataList: fetchDataList,
            deleteBtnProps:{
                icon: "el-icon-delete",
                style:"color:red"
            },
            updateBtnProps:{
                icon: "el-icon-edit",
            },
            actionColumns:{
                minWidth:"350",
                actionBtns:[
                    {
                        btnText:"详情",
                        icon:"el-icon-edit",
                    }, 
                    {
                        btnText: "定位",
                        icon: "el-icon-edit",
                    },
                    {
                        btnText: "站属充电桩",
                        icon: "el-icon-edit",
                    },
                ]
            }
        },
        dialogForm:{
            inlineLabelWidth: "110px",
            setterFormValue:[
                {
                    component:"ColumnGroup",
                    items:[
                        {
                            component: "Input",
                            label: "充电站名称",
                            display:"inline-block",
                            name: "name",
                            placeholder: "请输入充电站名称",
                            required: true
                        },
                        {
                            label: "充电站编码",
                            name: "code",
                            display: "inline-block",
                            component: "Input",
                            placeholder: "请输入充电站编码",
                            required: true,
                        },
                    ]
                },
                {
                    component: "ColumnGroup",
                    items: [
                        {
                            label: "充电站类型",
                            name: "type",
                            component: "Select",
                            placeholder: "请选择充电站类型",
                            required: true,
                            dataSource: [
                                { label: "类型1", value: 1 },
                                { label: "类型2", value: 2 },
                                { label: "类型3", value: 3 },
                            ]
                        },
                        {
                            label: "充电桩个数",
                            name: "chargeNum",
                            component: "Input",
                            placeholder: "请输入充电桩个数",
                            required: true,
                        },
                    ]
                },
                {
                    component: "ColumnGroup",
                    cols:[12,7,5],
                    items: [
                        {
                            label: "充电站状态",
                            name: "status",
                            component: "Select",
                            placeholder: "请选择充电站状态",
                            required: true,
                            dataSource: [
                                { label: "状态1", value: 1 },
                                { label: "状态2", value: 2 },
                                { label: "状态3", value: 3 },
                            ]
                        },
                        {
                            label: "经度和纬度",
                            name: "lat",
                            component: "Input",
                            placeholder: "请输入经度"
                        },
                        {
                            name: "lng",
                            component: "Input",
                            placeholder: "请输入纬度"
                        },
                    ]
                },
                {
                    component: "ColumnGroup",
                    items: [
                        {
                            label: "充电站详细地址",
                            name: "address",
                            component: "CascaderSelect",
                            placeholder: "请选择省市区",
                            dataSource: options,
                            props: {
                                checkStrictly: false,
                                expandTrigger: "click"
                            }
                        },
                        {
                            name: "addressInfo",
                            component: "Input",
                            placeholder:"请输入具体道路及位置"
                        },
                    ]
                },
                {
                    component:"ColumnGroup",
                    items:[
                        {
                            label: "电站所属运营商",
                            name: "com",
                            component: "Input",
                            placeholder: "请输入电站所属运营商",
                        },
                        {
                            label: "支付方式(多选)",
                            name: "pay",
                            component: "CheckboxGroup",
                            dataSource: [
                                { label: "APP",value:1 },
                                { label: "APP", value: 2 },
                                { label: "APP", value: 3 },
                                { label: "APP", value: 4 },
                            ],
                        },
                    ]
                },
                {
                    component:"ColumnGroup",
                    cols:[9,3,7,5],
                    items:[
                        {
                            label: "停车收费标准",
                            component: "Input",
                            name: "park",
                        },
                        {
                            name: "free",
                            component: "CheckboxGroup",
                            dataSource: [
                                { label: "免费",value:1 },
                            ]
                        },
                        {
                            label: "营业时间",
                            name:"startTime",
                            component:"DatePicker",
                        },
                        {
                            name: "endTime",
                            component: "DatePicker",
                        }
                    ]
                }
            ],
            onOk:(values)=>{
                console.log("values:",values);
                return new Promise((resolve)=>{
                    setTimeout(()=>{
                        resolve(true)
                    },2000)
                })
            }
        }

    }
}